package com.qms.qep.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.qms.common.core.controller.BaseController;
import com.qms.common.core.domain.AjaxResult;
import com.qms.qep.domain.InspectionStandardItem;
import com.qms.qep.service.IInspectionStandardItemService;

/**
 * 检验标准项目Controller
 * 
 * @author qms
 * @date 2025-05-14
 */
@RestController
@RequestMapping("/qep/inspection/standard")
public class InspectionStandardItemController extends BaseController
{
    @Autowired
    private IInspectionStandardItemService inspectionStandardItemService;

    /**
     * 根据产品ID查询检验标准项目列表
     */
    @PreAuthorize("@ss.hasPermi('qep:inspection:query')")
    @GetMapping("/items/{productId}")
    public AjaxResult getStandardsByProductId(@PathVariable("productId") Long productId)
    {
        List<InspectionStandardItem> list = inspectionStandardItemService.selectInspectionStandardItemByProductId(productId);
        return success(list);
    }

    /**
     * 获取检验标准项目详细信息
     */
    @PreAuthorize("@ss.hasPermi('qep:inspection:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(inspectionStandardItemService.selectInspectionStandardItemById(id));
    }
} 